package com.gouying.design.patterns.chain;

import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class Teacher {

    private String name;

    private Teacher next;
    public Teacher(String name) {
        this.name = name;
    }

    public void handlerRequest(){
        System.out.println(this.name+"处理了");
        if(next!=null){
            next.handlerRequest();
        }
    }
}
